package it.poste.il.compensatore.dao;

import it.poste.il.compensatore.entities.BaseEntity;
import it.poste.il.compensatore.exceptions.dao.EntityNotFoundException;

import java.util.List;

/**
 * Interface from all other interfaces.
 */
public interface BaseEntityDao<T extends BaseEntity> {
	
	/**
	 * Take entity from id.
	 * @param entityId Id of the entity.
	 * @return T Entity that return.
	 */
    T loadById(Long entityId) throws EntityNotFoundException;
    
	/**
	 * Take list of the entity.
	 * @return List<T> List of the entity.
	 */
    List<T> loadAll();

	/**
	 * Save of the entity.
	 * @param T Entity to save.
	 * @return T Entity that return.
	 */
    T save(T entity);

	/**
	 * Update of the entity.
	 * @param T Entity to update.
	 * @return void
	 */
    void update(T entity);

	/**
	 * Delete of the entity.
	 * @param T Entity to delete.
	 * @return void
	 */
    void delete(T entity);
}
